<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>


<!--bi-->
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/bi.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/bi.js"></script>
<script language="javascript">
function selData(action,dateType,doType){
    $('#searchForm').attr('action', action);
	$('#dateType').attr('value', dateType);
	$('#doType').attr('value', doType);
    $('#searchForm').submit();
}


<!-- 更新渠道时，更新sourceId start-->
$(function(){
	$("#select").change(function(){
	if($.trim($("#source").val())!=''){
		$(".sourceId-con").hide();
		$(".sourceId-con-loading").show();
		//$("#sourceId").attr('value','');
		var self=$("#select_sourceId")[0];
			 $.ajax({ url: "<?php echo $this->projectUrl(array('controller'=>'act-day-data-pagevisit','action'=>'sourceids'));?>",
				 type:"post",           
				 dataType:"json",
				 data: "source="+$("#source").val(),
				 success:function(data){ 
						self.options.length=0;
						self.options[0] = new Option('==选择==', '');
						var default_val=$("#default_sourceId").val();
						var flag =0;
						$.each(data,function(i){
							self.options[i+1] = new Option(data[i], data[i]);
							if(default_val==data[i]) {										 
								self.options[i+1].selected=true;
								$("#sourceId").attr('value',default_val);	
								flag =1;																				
							} 
						}); 
						if(flag ==0){
							$("#sourceId").attr('value','');
						}
						$(".sourceId-con").show();
						$(".sourceId-con-loading").hide();	
				 } 
			 });
		}	
	})
	if($.trim($("#source").val())!=''){
		$("#select").change();
	}
})
<!-- 更新渠道时，更新sourceId  end-->

</script>

</head>
<body style="overflow:auto;">
<div id="main" style="clear:both;">
		<div class="bi-body">
			<form id="searchForm" name="searchForm" method="post" action="<?php echo $this->projectUrl(array('action'=>'index'));?>" >
			<div class="bi-search  bi-search-2">
				<div class="bi-s-top"></div>
				<div class="bi-s-center">
					<div class="bi-s-c-con">
						<div class="bi-s-c-sel">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
							  <tr>
							  	<td colspan="5">
									<!-- 时间选择条 -->
									<div id="timeRange">
										<a onclick="selData('<?php echo $this->projectUrl(array('action'=>'index')) ;?>',2,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==2 ? 'currentTimeRange' : ''?>">最近7天</a>
										<a onclick="selData('<?php echo $this->projectUrl(array('action'=>'index')) ;?>',3,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==3 ? 'currentTimeRange' : ''?>">最近30天</a>
										<a onclick="selData('<?php echo $this->projectUrl(array('action'=>'index')) ;?>',4,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==4 ? 'currentTimeRange' : ''?>">最近三个月</a> 
										<a onclick="selData('<?php echo $this->projectUrl(array('action'=>'index')) ;?>',5,<?php echo $this->vars['doType'];?>);" class="<?php echo $this->vars['dateType']==5 ? 'currentTimeRange' : ''?>">全部</a>&nbsp;&nbsp;&nbsp;&nbsp;
										<span>日期选择</span>：<input name="startTime" type="text" class="input" id="startTime" size="18" value="<?php echo $this->vars['startTime'];?>" /><script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"startTime","button":"startTime"});</script>
						-
						<input name="endTime" type="text" class="input" id="endTime" size="18" value="<?php echo $this->vars['endTime'];?>" />
						<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"endTime","button":"endTime"});</script>
									</div>
									<!-- 时间选择条 -->								</td>
								<td rowspan="2">
									<input type="hidden" name="dateType" id="dateType" value="<?php echo $this->vars['dateType'];?>" />
									<input type="hidden" name="doType" id="doType" value="<?php echo $this->vars['doType'];?>" />	
									<input name="search" type="button" id="search" value="" class="s-button" onclick="selData('<?php echo $this->projectUrl(array('action'=>'index')) ;?>',6,<?php echo $this->vars['doType'];?>);"/>								</td>
							  </tr>
							  
							  <tr>
								  <td>操作系统：
										<select name="osName" id="osName" size="1">
											<option value="">全部</option>
											<?php foreach($this->osNameRows as $key=>$row) {?>
											<option value="<?php echo $row[0];?>" <?php if($this->vars['osName']==$row[0]){?>selected="selected"<?php }?>><?php echo $row[1];?></option>
											<?php }?>
										</select></td>		
									<td >渠道：</td>
									<td ><div style="position: relative; width:130px;">
										<select  name="select" id="select" class="select-write" onchange="source.value=select.value;source.select()">
											<option value="">==选择==</option>   
											<?php 
												for($i=0;$i<=9;$i++):
											?>
											  <option value="<?php echo isset($this->sourceFindArr[$i]['name']) ? $this->sourceFindArr[$i]['name'] : '';?>" 
											  <?php 
											  	if(isset($this->sourceFindArr[$i]['name']) && $this->vars['source']==$this->sourceFindArr[$i]['name']){?>selected="selected"
											  <?php }?>
											  
											  ><?php echo isset($this->sourceFindArr[$i]['name']) ? $this->sourceFindArr[$i]['name'] : '';?></option>   
											<?php 
												endfor;
											?>
										  </select>   
  							 			 <input type="text" class="text-write" name="source" id="source" value="<?php echo $this->vars['source'];?>"/>
										</div>									</td>
									<td >SourceId ：</td>
									<td><div style="position: relative; width:130px;" class="sourceId-con">
										<select name="select_sourceId" id="select_sourceId" class="select-write" onchange="sourceId.value=select_sourceId.value;sourceId.select()">
											<option value="">==选择==</option> 
										</select>
										<input type="text" class="text-write" name="sourceId" id="sourceId" value="<?php echo $this->vars['sourceId'];?>"/>
										<input type="hidden" name="default_sourceId" id="default_sourceId" value="<?php echo $this->vars['sourceId'];?>" />
										</div>
										<div class="sourceId-con-loading" style="width:130px;display:none;">加载中...</div>									</td>
								  </tr>
								</table>
						</div>
									
						
						
					</div>	
				</div>
				<div class="bi-s-bottom"></div>			
			</div>
			</form>
			
			
			
			<div class="clear" style="height:20px;"></div>
			<div class="bi-data">
				<div class="bi-d-top">
					<div class="d-t-left">回访用户数量</div>
					<div class="d-t-right"><span <?php if(count($this->rows)>0){?>class="show"<?php } else {?>class="hide"<?php }?> id="data_01" onclick="showData('01')" style="cursor:pointer;"></span></div>
				</div>
				<div class="bi-d-center  clear" id="data01">
					<div class="bi-d-center-bg">
					<!--content start-->


					<span class="d-line"></span>
					<div id="content" >
						<script type="text/javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/highcharts/js/highcharts.js"></script>
						<script type="text/javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/highcharts/js/modules/exporting.js"></script>
						<script type="text/javascript">
							var chart;
							$(document).ready(function() {
								chart = new Highcharts.Chart({
									chart: {
										renderTo: 'clientnum',
										defaultSeriesType: 'line',
										marginRight: 5,
										marginBottom: 125
									},
									title: {
										text: '',
										x: -20 //center
									},
									subtitle: {
										text: '',
										x: -20
									},
									xAxis: {
										
										categories: [<?php echo $this->highchart['dateim']?>],
										
										size: 100,
										labels: {
											rotation: -70,
											align: 'right'
										}
									},
									yAxis: {
										title: {
											text: '数量'
										},
										plotLines: [{
											value: 0,
											width: 1,
											color: '#808080'
										}]
									},
									tooltip: {
										//enabled: false,
										formatter: function() {
												return '<b>'+ this.series.name +'</b><br/>'+
												this.x + '日: '+ this.y +'个'+this.series.name;
										}
									},
									legend: {
										style: {
												 font: 'normal 12px Verdana, sans-serif'
											}
									},
									series: [{
										name: '当日新增用户',
										data: [<?php echo $this->highchart['dayInstallNum'];?>]
									}, {
										name: '回访用户',
										data: [<?php echo $this->highchart['returnVisit'];?>]
									}]
									
								});
								
								
							});
								
						</script>

						<!-- 3. Add the container -->
						<div id="container">
							<div id="clientnum" style="width: 710px; height: 400px; position:relative;overflow:hidden;"></div>
						</div>
						
						
					</div>
					<span class="d-line"></span>
					
					<!--content end-->
					</div>
				</div>
				<div class="bi-d-bottom"></div>
			</div>
			

			<div class="clear" style="height:20px;"></div>
			<div class="bi-data">
				<div class="bi-d-top">
					<div class="d-t-left">重购用户数量</div>
					<div class="d-t-right"><span <?php if(count($this->rows)>0){?>class="show"<?php } else {?>class="hide"<?php }?> id="data_02" onclick="showData('02')" style="cursor:pointer;"></span></div>
				</div>
				<div class="bi-d-center  clear" id="data02">
					<div class="bi-d-center-bg">
					<!--content start-->


					<span class="d-line"></span>
					<div id="content" >
						<script type="text/javascript">
							var chart;
							$(document).ready(function() {
								chart = new Highcharts.Chart({
									chart: {
										renderTo: 'clientnum2',
										defaultSeriesType: 'line',
										marginRight: 5,
										marginBottom: 125
									},
									title: {
										text: '',
										x: -20 //center
									},
									subtitle: {
										text: '',
										x: -20
									},
									xAxis: {
										
										categories: [<?php echo $this->highchart['dateim']?>],
										
										size: 100,
										labels: {
											rotation: -70,
											align: 'right'
										}
									},
									yAxis: {
										title: {
											text: '数量'
										},
										plotLines: [{
											value: 0,
											width: 1,
											color: '#808080'
										}]
									},
									tooltip: {
										//enabled: false,
										formatter: function() {
												return '<b>'+ this.series.name +'</b><br/>'+
												this.x + '日: '+ this.y +'个'+this.series.name;
										}
									},
									legend: {
										style: {
												 font: 'normal 12px Verdana, sans-serif'
											}
									},
									series: [{
										name: '当日订单量',
										data: [<?php echo $this->highchart['dayOrderNum'];?>]
									}, {
										name: '重购订单量',
										data: [<?php echo $this->highchart['returnBuy'];?>]
									}]
									
								});
								
								
							});
								
						</script>

						<!-- 3. Add the container -->
						<div id="container2">
							<div id="clientnum2" style="width: 710px; height: 400px; position:relative;overflow:hidden;"></div>
						</div>
						
						
					</div>
					<span class="d-line"></span>
					
					<!--content end-->
					</div>
				</div>
				<div class="bi-d-bottom"></div>
			</div>

			<div class="clear" style="height:20px;"></div>
			<div class="bi-data">
				<div class="bi-d-top">
					<div class="d-t-left">回访用户详情</div>
					<div class="d-t-right"><span <?php if(count($this->datatoday)>0){?>class="show"<?php } else {?>class="hide"<?php }?> id="data_03" onclick="showData('03')" style="cursor:pointer;"></span></div>
				</div>
				<div class="bi-d-center  clear" id="data03">
					<div class="bi-d-center-bg">
					<!--content start-->
					<span class="d-line"></span>
					<table class="table">
						<tr class="subject">
							<td>日期</td>
							<td>当日新增用户数</td>
							<td>当日新增激活用户订单数</td>
							<td>当日回访用户数</td>
							<td>当日回访用户订单数</td>
						</tr>
						<?php
						foreach ($this->listArr as $k => $v) :
						?>
						<tr>
							<td><?php echo $k;?></td>
							<td><?php echo $v['installNum'];?></td>
							<td><?php echo $v['installOkOrderNum'];?></td>
							<td><?php echo $v['returnVisit'];?></td>
							<td><?php echo $v['returnBuy'];?></td>
						</tr>
						<?php endforeach;?>
						<tr class="subject">
							<td>总计</td>
							<td><?php echo $this->endArr['totalInstallNum'];?></td>
							<td><?php echo $this->endArr['totalInstallOkOrderNum'];?></td>
							<td><?php echo $this->endArr['totalReturnVisit'];?></td>
							<td><?php echo $this->endArr['totalReturnBuy'];?></td>
						</tr>

				  	</table>
					<!--content end-->
					</div>
				</div>
				<div class="bi-d-bottom"></div>
			</div>
			
			
			
		</div>
	
</div>

</body>
</html>